/*
 * FTPFile.java
 *
 * Created on December 3, 2006, 8:15 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package eu.somatik.somaftp.logic.ftp;

import com.glub.secureftp.bean.RemoteFile;
import eu.somatik.somaftp.logic.*;
import eu.somatik.somaftp.logic.FileInterface;

/**
 *
 * @author francisdb
 */
public class FTPFile extends AbstractFile{
    
    private FTPFileSystem fileSystem;
    
    private RemoteFile file;
    
    private boolean direcory;
    
    /** Creates a new instance of FTPFile */
    public FTPFile(RemoteFile file, FTPFileSystem fileSystem) {
        if (file.isDirectory()  || "..".equals(file.getFileName())){
            direcory = true;
        }else{
            direcory = false;
        }
        this.file = file;
        this.fileSystem = fileSystem;        
    }
    
    public String getName(){
        return file.getFileName();
    }

    public boolean isDirectory() {
        return direcory;
    }

    public boolean isLink() {
        return file.isLink();
    }
    
    public RemoteFile getFileObject() {
        return file;
    }
    
    public String toString(){
        return getName();
    }

    public FileSystemInterface getFileSystem() {
        return fileSystem;
    }

    public long getSize() {
        if(file.isDirectory()){
            return -1;
        }else{
            return file.getFileSize();
        }
    }

}
